package com.psp.dao.impl;


import java.util.List;

import org.springframework.stereotype.Repository;

import com.psp.base.BaseDaoImpl;
import com.psp.dao.UserDao;
import com.psp.domain.User;

@Repository
public class UserDaoImpl extends BaseDaoImpl<User> implements UserDao{

	@Override
	public User findByLoginName(String loginName) {
		
		return (User) getSession().createQuery("from User where loginName=?")
				.setString(0, loginName).uniqueResult();
	}
	
	@Override
	public User getById(Long id) {
		System.out.println("HJHJJH");
		return super.getById(id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<User> findUserByDepartmentId(Long departmentId) {
		// TODO Auto-generated method stub
		return getSession().createQuery("from User where departmentId=?")
				.setLong(0, departmentId).list();
	}
}
